﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CMSLibrary;

public partial class UControls_WUC_Class_Manage : PSControls
{
    #region 私有成员
    string classTitle = "类别：";
    string targetPath = "00";
    bool isShowTop = false;
    int _level = -1;
    int lsb_width = 300;
    int lsb_height = 400;
    int valbind = 1;
    #endregion

    #region 属性
    /// <summary>
    /// 设置是否绑定值类型为ID
    /// </summary>
    public int ValBind
    {
        set { valbind = value; }
    }
    /// <summary>
    /// 控件宽度
    /// </summary>
    public int lsb_Width
    {
        set { lsb_width = value; }
    }
    /// <summary>
    /// 控件高度
    /// </summary>
    public int lsb_Height
    {
        set { lsb_height = value; }
    }
    /// <summary>
    /// 设置节点层级
    /// </summary>
    public int NodeLevel
    {
        set { _level = value; }
    }
    /// <summary>
    /// 设置是否显示顶级节点
    /// </summary>
    public bool IsShowTop
    {
        set { isShowTop = value; }
    }
    /// <summary>
    /// 类别名称
    /// </summary>
    public string ClassTitle
    {
        set { classTitle = value; }
    }
    /// <summary>
    /// 节点入口点
    /// </summary>
    public string TargetPath
    {
        set { targetPath = value; }
    }
    #endregion

    #region 抽象属性
    public override string Client_ClassID
    {
        get { return lsb_Class.ClientID; }
    }
    public override ListControl GetClassControl
    {
        get { return lsb_Class; }
    }
    #endregion

    #region 抽象方法
    public override void ListControl_DataBind()
    {
        lsb_Class.Width = lsb_width;
        lsb_Class.Height = lsb_height;

        DataTable dt = DataEntity.tab_Class.SelectList(targetPath, _level, isShowTop);
        lsb_Class.Items.AddRange( GlocalCache.GetProjectNodes_ListItems(dt, valbind) );
        lsb_Class.Items.Insert(0, new ListItem("--根节点--", "00"));
    }
    #endregion
}
